﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LFMTest
{
    static class CollectionExtentions
    {
        /// <summary>
        /// Adds all elements of an IEnumeralbe to an exisiting ObservableCollection
        /// </summary>
        /// <typeparam name="T">Type of ObservableCollection</typeparam>
        /// <param name="collection">THe collection to add too</param>
        /// <param name="list">The IEnumerable data type to add data from</param>
        /// <returns>ObeservableCollection with additional data</returns>
        public static ObservableCollection<T> AddIEnumerable<T>(this ObservableCollection<T> collection, IEnumerable<T> enumerable)
        {
            foreach (var a in enumerable) collection.Add(a);
            return collection;
        }
    }
}
